/*
 * Copyright (c) 2017,安徽皖通科技股份有限公司 All rights reserved.
 */

package com.wttech.dzzf.process.dao;

import com.wtkj.dao.impl.ListResultSetExtractor;
import com.wtkj.vo.dzzf.base.kfwd.FundAccount;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

import javax.annotation.Resource;
import java.util.List;

/**
 * 错误用户名称或经办人名称DAO
 *
 * @author MaShibo
 * @date 2017/11/8.
 */
@Repository
public class ErrorUserNameDao {

    @Resource(name = "jdbcTemplate")
    private JdbcTemplate testJdbcTemplate;

    public int queryFundAccontNum() {
        return testJdbcTemplate.queryForObject("SELECT COUNT(1) FROM AC_FUNDACCOUNT A WHERE A.ACCOUNTSTATUS=1 ", Integer.class);
    }

    public List<FundAccount> queryFundAccountInfosByRow(int startRow, int endRow) {
        final String sql =
                "SELECT * " +
                        "  FROM (SELECT A.*, ROWNUM AS RM FROM AC_FUNDACCOUNT A) " +
                        " WHERE RM >= ? " +
                        "   AND RM <= ?";
        return (List<FundAccount>) testJdbcTemplate.query(sql, new ListResultSetExtractor(new FundAccount()), startRow, endRow);
    }
}
